class PSKismetGotItem extends SequenceAction;

var PSPlayerController pc;
var() int ItemAmount;

event Activated()
{
	if (InputLinks[0].bHasImpulse)
	{
		pc = none;

		OutputLinks[0].bHasImpulse=false;
		OutputLinks[1].bHasImpulse=false;

		if (Targets.length == 0)
		{
			`Log("WARNING: No Target for Subtitle DisplayText");
		}
		else
		{
			if(Targets[0].IsA('PSPlayerController'))
			{
				pc = PSPlayerController(Targets[0]);
			}
			else if(Targets[0].IsA('PSPawnDidrik'))
			{
				pc = PSPlayerController(PSPawnDidrik(Targets[0]).Controller);
			}


			if(pc==none) 
			{
				ActivateOutputLink(0);
			}
			else
			{
				if(pc.Pawn.Health< pc.Pawn.HealthMax)
				{
					pc.PSGotMedikit(ItemAmount);
					ActivateOutputLink(1);
				}
				else
				{
					ActivateOutputLink(0);
				}
			}
			
		}
	}
	else
	{
		ActivateOutputLink(0);
	}
}


DefaultProperties
{
	ObjName="PSKismetGotItem"
	ObjCategory="PS Actions"

	bAutoActivateOutputLinks=false
	

	InputLinks(0)=(LinkDesc="Medikit")
	InputLInks(1)=(LinkDesc="Ammo")

	OutputLinks(0)=(LinkDesc="Leave")
	OutputLinks(1)=(LinkDesc="Take")
	OutputLinks(2)=(LinkDesc="otro")
}
